﻿
using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;
using YouHP.Model.Group;

namespace YouHP.Pages.Profile
{
    public class CommentDel : YouHP.Pages.BasePage
    {
        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleGet();
        }
        protected CommentInfo CommentData;

        protected void HandleGet()
        {
            int id = RequestTools.GetInt("id", 0);
            if (id <= 0)
            {
                this.AddErrLine("无效的参数 id");
                return;
            }

            CommentData = CommentBLL.Instance.GetCommentInfo(id);


            bool succ = CommentBLL.Instance.DeleteComment(new int[] {id});
            if (succ == true)
            {
                this.AddMsgLine("删除成功");
            }
            else
            {
                this.AddErrLine("删除失败");
            }
            this.SetUrl("/Profile/Index.aspx?uid="+CommentData.HostUserId);
            this.SetMetaRefresh();
        }
    }
}